import QtQuick 2.0
import NQFramework 1.0
import "Button.js" as Controller

NQRectangle{
    id: button
    objectName: setName("root")

    width: 150
    height: 86

    property alias text: title.text
    property alias source: bkg.source
    property alias imgId : bkg.imageId
    property alias strId : title.strId

    signal click(var mouse)

    function setName(name) {
        return "cc_btn_" + name;
    }

    NQImage {
        id: bkg
        objectName: setName("bkg")
        width: bkg.height
        height: parent.height
    }

    NQText {
        id: title
        objectName: setName("title")
        height: parent.height
        font.pointSize: 12
        verticalAlignment: NQText.AlignVCenter
        anchors.right: parent.right
        anchors.left: parent.left
        anchors.leftMargin: 5 + bkg.width
    }

    NQMouseArea{
        anchors.fill: parent
        onClicked: {
            Controller.onClicked(mouse)
        }
        onReleased: Controller.onReleased(mouse)
        onPressed: Controller.onPressed(mouse)
    }
}
